package org.romzzz.gwtclassifieds.client.data;

import java.io.Serializable;
import java.util.Date;
import com.extjs.gxt.ui.client.data.BaseModelData;


/**
 * Usage of the GXT data model to wrap a simple classified ad.
 */
public class ClassifiedBean extends BaseModelData implements Serializable {
	
	private static final long serialVersionUID = -6753807726033432074L;
	
	public ClassifiedBean() {}
	
	public ClassifiedBean(Boolean offer, String title, String body, Date date, CategoryBean category, String contact) {
		setOffer(offer);
		setTitle(title);
		setBody(body);
		setDate(date);
		setCategory(category);
		setContact(contact);
		setId(-1L);
	}
	
	public ClassifiedBean(Long id, Boolean sell, String title, String body, Date date, CategoryBean category, String contact) {
		setOffer(sell);
		setTitle(title);
		setBody(body);
		setDate(date);
		setCategory(category);
		setContact(contact);
		setId(id);
	}

	public Long getId() {
		return get("id");
	}

	public void setId(Long id) {
		set("id", id);
	}
	
	public Boolean isOffer() {
		return get("offer");
	}
	
	public void setOffer(Boolean sell) {
		set("offer", sell);
	}

	public String getTitle() {
		return get("title");
	}

	public void setTitle(String title) {
		set("title", title);
	}

	public String getBody() {
		return get("body");
	}

	public void setBody(String body) {
		set("body", body);
	}

	public Date getDate() {
		return get("date");
	}

	public void setDate(Date date) {
		set("date", date);
	}

	public CategoryBean getCategory() {
		return get("category");
	}

	public void setCategory(CategoryBean category) {
		set("category", category);
    }
	
	public String getContact() {
		return get("contact");
	}
	
	public void setContact(String contact) {
		set("contact", contact);
	}

}
